﻿using System;
using System.Collections.Generic;
using System.Text;

using System.Configuration;
namespace Tickz
{
    /// <summary>
    /// 配置整个应用的参数
    /// </summary>
    public abstract class ConfigParams
    {
        /// <summary>
        /// 应用程序的真实路径
        /// </summary>
        private string applicationRootRealPath;

        public virtual string ApplicationRootRealPath
        {
             get { return applicationRootRealPath; }
            set { applicationRootRealPath = value; }
        } 
        /// <summary>
        /// 应用程序的虚路径
        /// </summary>
        private string applicationRootVirtualPath;

        public virtual string ApplicationRootVirtualPath
        {
            get { return applicationRootVirtualPath; }
            set { applicationRootVirtualPath = value; }
        }        

        public abstract string GetTickzConfig(string key);
        public abstract void SetTickzConfig(string key, string value);

        public static ConfigParams GetInstance()
        {
            string flag=ConfigurationManager.AppSettings["systemType"];
            if (flag.Equals("CS"))
            {
                return new CSConfigParams();
            }
            else
            {
                return new BSConfigParams();
            }           
        }
        /// <summary>
        /// 获得程序的配置信息
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static string GetConfigStr(string key)
        {
            return ConfigurationManager.AppSettings[key];
        }
    }
}
